#ifndef	LANGUAGE_GRAMMAR_H
#define LANGUAGE_GRAMMAR_H

#include "LanguageTranslations.h"
#include "LanguageIndex.h"
#include "FirstSet.h"
#include <vector>
#include <map>
#include <string>
using namespace std;

struct LanguageGrammar
{	
public:
	LanguageGrammar():first_calculator(&source_rules) {}
    LanguageGrammar(const LanguageGrammar& that);
    LanguageGrammar& operator=(const LanguageGrammar& that);
	void Initialize();
	void RemoveRepeatedTranslationRules();
	//获得默认文法开始符号(第一条文法的root_symbol)
	virtual Symbols GetDefaultStartSymbol() const;
	std::string ToString();
    void Save(ostream& o) const;
    void Load(istream& i);
public:
	vector<LanguageTranslations> translation_rules;
public:
	LanguageIndex source_rules;
	LanguageIndex destination_rules;
	FirstCalculator first_calculator;
	string grammar_file_name;	//編譯器對應的原始語法文件名
};

ostream& operator<< (ostream& o, const LanguageGrammar& lg);

#endif	//LANGUAGE_GRAMMAR_H
